package com.hxd.mall.module.usercenter.order

import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.hxd.mall.R
import com.hxd.mall.module.usercenter.home.NavigatePage
import com.hxd.mall.utils.open.load

/**
 * @author zhaoyong
 * @description:
 * @date :2019-10-18 17:48
 */
class OrderItemAdapter : BaseQuickAdapter<NavigatePage, BaseViewHolder>(R.layout.adapter_order_item_layout) {
    override fun convert(helper: BaseViewHolder?, item: NavigatePage?) {

        helper?.run {
            item?.run {
                getView<ImageView>(R.id.iv_pic).load(item.skuPictUri, R.mipmap.product_item_icon,R.mipmap.product_item_icon)
                setText(R.id.tv_orderNo, "订单号：${item.channelOrderNo}")
                setText(R.id.tv_title_name, item.skuTitle)
                setText(R.id.tv_time, "付款时间：${item.paidTime}")
                setText(R.id.tv_amount, "付款：¥${item.paidAmount}")
                setText(R.id.tv_income, item.estimatedIncome)
                setText(
                    R.id.tv_status, when (item.status) {
                        "UNSETTLED" -> "未结算"
                        "SETTLED" -> "已结算"
                        "CANCEL" -> "已取消"
                        else -> ""
                    }
                )

            }
        }
    }
}